Improve performance when checking case-sensitivity of Tramp file names
authorJim Porter <jporterbugs@gmail.com>
Tue, 9 Nov 2021 18:59:14 +0000 (19:59 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 9 Nov 2021 18:59:14 +0000 (19:59 +0100)
* lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name):
Dissect file name before testing for connectability to reduce
duplicated work.

* lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p):
Use `tramp-connectable-p' to test for connection.

lisp/net/tramp-sh.el
lisp/net/tramp.el

index 6292190940640903edd39010881328affcaccf07..b20e5f80732b618d02eea4afbed4ebff63980ca7 100644 (file)
@@ -2705,11 +2705,11 @@ the result will be a local, non-Tramp, file name."
     ;; Unless NAME is absolute, concat DIR and NAME.
     (unless (file-name-absolute-p name)
       (setq name (tramp-compat-file-name-concat dir name)))
-    ;; If connection is not established yet, run the real handler.
-    (if (not (tramp-connectable-p name))
-       (tramp-run-real-handler #'expand-file-name (list name nil))
-      ;; Dissect NAME.
-      (with-parsed-tramp-file-name name nil
+    ;; Dissect NAME.
+    (with-parsed-tramp-file-name name nil
+      ;; If connection is not established yet, run the real handler.
+      (if (not (tramp-connectable-p v))
+         (tramp-run-real-handler #'expand-file-name (list name nil))
        (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
          (setq localname (concat "~/" localname)))
        ;; Tilde expansion if necessary.  This needs a shell which
index b152584c1f8b60640eac0433d23ead9fdd66f6bd..a8972ce69e8707e833ce1da6b40897a09b5643e6 100644 (file)
@@ -3484,7 +3484,7 @@ User is always nil."
      (tramp-get-method-parameter v 'tramp-case-insensitive)
 
      ;; There isn't.  So we must check, in case there's a connection already.
-     (and (file-remote-p filename nil 'connected)
+     (and (let ((non-essential t)) (tramp-connectable-p v))
           (with-tramp-connection-property v "case-insensitive"
            (ignore-errors
              (with-tramp-progress-reporter v 5 "Checking case-insensitive"